home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19950929-19951130
/
000133_news@columbia.edu_Wed Oct 18 15:01:09 1995.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
5KB
Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA05522
(5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Wed, 18 Oct 1995 11:01:16 -0400
Received: by apakabar.cc.columbia.edu id AA23968
(5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Wed, 18 Oct 1995 11:01:15 -0400
Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: How can I do "Screen scraping" with C-Kermit?
Date: 18 Oct 1995 15:01:09 GMT
Organization: Columbia University
Lines: 99
Message-Id: <4634rl$ncs@apakabar.cc.columbia.edu>
References: <45rqj4$ghm@its.hooked.net> <45tsp4$26k@apakabar.cc.columbia.edu> <45vfo6$8ik@its.hooked.net>
Nntp-Posting-Host: watsun.cc.columbia.edu
Apparently-To: kermit.misc@watsun.cc.columbia.edu
In article <45vfo6$8ik@its.hooked.net>,
Byron Morgan <bmorg@hooked.net> wrote:
: In <45tsp4$26k@apakabar.cc.columbia.edu>,
: fdc@watsun.cc.columbia.edu (Frank da Cruz) writes:
: > None of the Kermit programs presently implements this feature in
: > precisely that form. However, if you can be more specific about which
: > Kermit program you are talking about, and exactly what the effect is
: > you are trying to achieve, maybe we can be more helpful.
:
: I am using OS2 CKO191(A). Using a direct RS232 connection to an old DEC
: machine. The system posts subway train destination information to a
: monitor screen. Each of 20 subway station platforms is represented by a
: specific screen area. The application I would like to use C-Kermit for
: would check the appropriate screen addresses for train information,
: store the information in variables, then periodically (every 5 seconds,
: for example) check each screen location for changed information. If this
: can not be done with C-Kermit, I suppose it could be done with REXX,
: which I have never used.
:
Now that's a challenge. And I take it that there is nothing in the actual
text that identifies which platform the train is on -- that would make it
too easy :-) Of course, if that is true, then it is also hard to see how
a textual "trigger" would have helped. Thus you have to know the screen
position of each piece of text.
OK, let's assume that the screen is updated in random fashion, but with
the constraint that each platform is done all at once, as follows:
<cursor-position-sequence><text><some-other-escape-sequence>
There are 20 positions on the screen, so you need to be able to identify
twenty <cursor-position-sequence>'s. Let's use the brute force method:
define \%a \27[y1;x1H
define \%b \27[y2;x2H
define \%c \27[y3;x3H
...
define \%t \27[y20;x20H
where the xn's and yn's are the column and row for each entry. For
example, if the Platform 1 text appears in column 1, row 2:
define \%a \27[2;1H
Suppose updates occur at least every 60 seconds. So wait for one of these
sequences:
minput 60 \%a \%b \%c ... \%t
if fail stop 1 Something bad
If updates occur at irregular intervals, then you need not be so strict:
minput 60 \%a \%b \%c ... \%t
while FAILURE {
echo Nothing happening at \v(time)...,-
minput 60 \%a \%b \%c ... \%t -
}
(or just increase the INPUT timeout to some big number).
Once you get this far, the \v(minput) variable contains the number, 1-20,
of item that was matched. If the train platforms are numbered 1 through
20, you can arrange these variables correspondingly in the MINPUT command,
so the \v(minput) value will be the same as the platform number. If not,
you can have a conversion function or lookup table (array).
Next, get the text:
clear input ; Clear out everything up to and including the escape sequence
input 10 \27 ; Wait for the next ESC
if fail stop 1 Something else bad ; Insert appropriate error handling
assign \%z \v(input) ; Get a copy of the text
assign \%z \fsubstring(\%z,\feval(\flength(\%z) - 1)) ; Discard the ESC
Now, hopefully, you have all the information you need:
- \v(minput) contains a number 1 through 20 that tells which screen
position the text came from, from which you can deduce the platform
numbers.
- \%z contains the corresponding text.
Let's say you also want to record the date and time that each entry was
picked up.
declare \&d[20] ; Date/time array
and then:
assign \%d[\v(minput)] \v(date) \v(time)
Put the whole thing in a big loop, and off you go.
This is all totally untested, so you'll need to do the debugging and
refinement. Be sure to post the result!
- Frank